package com.cn.api;


import com.cn.dto.CouponDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Primary
@Component
@FeignClient(value = "coupon-client", path = "/coupon/api")
public interface CouponFeignClient {
    @PostMapping("/findAllCoupon")
    List<CouponDTO> findAllCoupon(@RequestBody CouponDTO couponDTO);

    @PostMapping("/findById")
    CouponDTO findById(@RequestParam("id") int id);

    @PostMapping("/findByStatus")
    CouponDTO findByStatus(@RequestParam("status") int status);

    @PostMapping("/createCoupon")
    int createCoupon(@RequestBody CouponDTO couponDTO);

    @PostMapping("/editCoupon")
    Integer editCoupon(@RequestBody CouponDTO couponDTO);

    @PostMapping("/deleteCoupon")
    Integer deleteCoupon(@RequestParam("id") int id);

    @PostMapping("/enable")//启用停用
    Integer enable(@RequestParam("id") int id);

    @PostMapping("/findAllDetailed")
    List<CouponDTO> findAllDetailed(@RequestBody CouponDTO couponDTO);

    @PostMapping("/findByNumber")
    CouponDTO findByNumber(@RequestParam("number") String number);

    @PostMapping("/findByState1")
    CouponDTO findByState(@RequestParam("state") int state);
}
